package com.strange.mdl.module.mdl.dal.mysql.videoinfo;

import java.util.*;

import com.strange.mdl.framework.common.pojo.PageResult;
import com.strange.mdl.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.strange.mdl.framework.mybatis.core.mapper.BaseMapperX;
import com.strange.mdl.module.mdl.dal.dataobject.videoinfo.MdlVideoInfoDO;
import org.apache.ibatis.annotations.Mapper;
import com.strange.mdl.module.mdl.controller.admin.videoinfo.vo.*;

/**
 * 视频信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MdlVideoInfoMapper extends BaseMapperX<MdlVideoInfoDO> {

    default PageResult<MdlVideoInfoDO> selectPage(MdlVideoInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MdlVideoInfoDO>()
                .eqIfPresent(MdlVideoInfoDO::getTitle, reqVO.getTitle())
                .eqIfPresent(MdlVideoInfoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(MdlVideoInfoDO::getCoverUrl, reqVO.getCoverUrl())
                .eqIfPresent(MdlVideoInfoDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(MdlVideoInfoDO::getDuration, reqVO.getDuration())
                .eqIfPresent(MdlVideoInfoDO::getFileSize, reqVO.getFileSize())
                .eqIfPresent(MdlVideoInfoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MdlVideoInfoDO::getPublishTime, reqVO.getPublishTime())
                .betweenIfPresent(MdlVideoInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MdlVideoInfoDO::getId));
    }

}